package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 部门管理
 */
@Mapper
public interface DeptMapper {

    @Select("select * from dept order by update_time desc")
    List<Dept> list();

    /**
     * 根据id删除部门
     */
    @Delete("delete from dept where id = #{id}")
    void deleteById(Integer id);

    /**
     * 添加部门
     * @param dept
     */
    @Insert("insert into dept(name, create_time, update_time) values(#{name},#{createTime},#{updateTime})" )
    void insert(Dept dept);

    /**
     * id查询部门信息
     * @param id
     * @return Dept
     */

    @Select("select * from dept where id = #{id}")
   Dept selectById(Integer id);

    /**
     * 修改部门信息
     * @param dept
     * */
    @Update("update dept set name=#{name},update_time=#{updateTime} where id = #{id}")
    void put(Dept dept);
}
